<?php
declare(strict_types=1);

namespace App\Services;

use App\Interface\PaymentStrategyInterface;
use App\Interface\Pay\WeChatPaymentStrategy;
use App\Interface\Pay\AliPaymentStrategy;
use Hyperf\HttpServer\Contract\RequestInterface;
use InvalidArgumentException;

class PaymentStrategyFactory
{
    public static function createPaymentStrategy($paymentMethod): PaymentStrategyInterface
    {
        return match ($paymentMethod['pay_type']) {
            'wx_lite' => new WeChatPaymentStrategy(),
            'alipay_lite' => new AliPaymentStrategy(),
            default => throw new InvalidArgumentException('Unsupported payment method'),
        };
    }
}
